@echo off
chcp 65001 > nul

REM Props Management Demo 启动脚本 (Windows)
REM =========================================

echo 🚀 Starting Props Management Demo...
echo ======================================

REM 检查 Java
java -version > nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ Java is not installed. Please install Java 17 or higher.
    pause
    exit /b 1
)

REM 检查 Maven
mvn -version > nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ Maven is not installed. Please install Maven.
    pause
    exit /b 1
)

echo ✅ Environment check passed!
echo.

REM 编译项目
echo 📦 Building project...
mvn clean compile -q
if %errorlevel% neq 0 (
    echo ❌ Build failed!
    pause
    exit /b 1
)

echo ✅ Build successful!
echo.

REM 启动演示应用
echo 🎯 Starting demo application...
echo ===============================
echo 📱 Management Interface: http://localhost:8080/props-management/index.html
echo 🔧 Demo API Endpoints:
echo    - http://localhost:8080/demo/config
echo    - http://localhost:8080/demo/health
echo    - http://localhost:8080/demo/info
echo ===============================
echo.

REM 使用 demo profile 启动
mvn spring-boot:run -Dspring-boot.run.main-class=com.props.starter.Demo -Dspring-boot.run.profiles=demo -q

pause 